<template>
    <el-table :data="tableData" style="width: 100%" size="large" :row-style="rowStyle"
        :header-cell-style="{ background: '#F3F3F7' }">
        <el-table-column prop="auditDeptName" label="部门" />
        <el-table-column prop="firstAuditNum" label="送审总数" />
        <el-table-column prop="waitFirstAuditNum" label="待审核数" />
        <el-table-column prop="firstPassNum" label="审核通过数" />
        <!-- <el-table-column prop="firstPassPriceNum" label="核价通过" />
            <el-table-column prop="firstPassQualityNum" label="资质通过" /> -->
        <!-- </el-table-column> -->
        <el-table-column label="审核驳回数">
            <el-table-column prop="firstRejectPriceNum" label="仅核价驳回" />
            <el-table-column prop="firstRejectQualityNum" label="仅资质驳回" />
            <el-table-column prop="firstRejectAllNum" label="全部驳回" />
        </el-table-column>
        <el-table-column label="通过率">
            <template #default="scope">
                {{ passingRate(scope.row) }}
            </template>
        </el-table-column>
    </el-table>
</template>

<script setup lang="ts">
import { defineProps } from 'vue'
const props = defineProps(['tableData'])


// 通过率反显
const passingRate = (row: any) => {
    let num = Number(row.firstPassNum) / Number(row.firstAuditNum)
    if (!isNaN(num)) {
        return `${(num * 100).toFixed(2)}%`
    } else {
        return '0%'
    }
}

const rowStyle = (row: any) => {
    if (row.rowIndex % 2 !== 0) {
        return {
            background: '#F3F3F7'
        }
    } else {
        return {
            background: '#fff'
        }
    }
}
</script>

<style lang="scss" scoped></style>